<?php if( ! defined('BASEPATH')) exit('No direct script access allowed');

class Demo_model extends CI_Model {
	public function __construct()
	{
		parent::__construct();
	}
	
	function get()
	{
		
	   $this->datatables
			->select("users_groups.id,users.username,groups.name")
			->from("users_groups")
			->join('salary_account','users.id =  salary_account.user_id')
			/*->join('warehouses_products', 'products.id = warehouses_products.product_id')
			->select('(SELECT SUM(warehouses_products.quantity) FROM warehouses_products WHERE warehouses_products.product_id=products.id) AS totalQuantity', FALSE)
			
			->select("warehouses_products.product_id as productid, products.image as image, products.code, products.name, products.unit, products.cost, products.price, alert_quantity,  sum(warehouses_products.quantity) as 'totalQuantity'")
			->from('warehouses_products')
			->join('products', 'warehouses_products.product_id=products.id', 'inner')
			->group_by("products.id")*/
			->add_column("Actions", 
			"<center>			<a href='index.php?module=groups&amp;view=edit&amp;id=$1'>
								<i class='icon-edit'></i>
								</a>
							    <a href='index.php?module=groups&amp;view=delete&amp;id=$1' onClick=\"return confirm('". $this->lang->line('alert_x_customer') ."')\">
								<i class='icon-trash'></i>
								</a></center>", "id")
			->unset_column('users.id');
		
		
	   return  $this->datatables->generate();
	}
}
